Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fastbench

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastbench

the simplest benchmark you can run on node

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
221
decreased by-77.17%
Maintainers
1
Weekly downloads
 
Created
Source

fastbench  Build Status

The simplest benchmark you can run on node

Install

npm install fastbench

Usage

'use strict'

var bench = require('fastbench')

var run = bench([
  function benchSetTimeout (done) {
    setTimeout(done, 0)
  },
  function benchSetImmediate (done) {
    setImmediate(done)
  },
  function benchNextTick (done) {
    process.nextTick(done)
  }
], 1000)

// run them two times
run(run)

Output:

benchSetTimeout*1000: 1363ms
benchSetImmediate*1000: 4ms
benchNextTick*1000: 1ms
benchSetTimeout*1000: 1365ms
benchSetImmediate*1000: 4ms
benchNextTick*1000: 0ms

You can disable colors by passing a --no-color flag to your node script.

API

bench(functions, iterations)

Build a benchmark for the given functions and that precise number of iterations. It returns a function to run the benchmark.

The iterations parameter can also be an Object, in which case it acceps two options:

  • iterations: the number of iterations (required)
  • max: is a an alias for iterations
  • color: if the output should have color (default: true)

License

MIT

Keywords

FAQs

Package last updated on 22 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc